﻿using CeremonyBackground.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CeremonyBackground.Infrastructure.EntityConfigurations
{
    public class WechatMomentEntityTypeConfiguration
        : IEntityTypeConfiguration<WechatMoment>
    {
        public void Configure(EntityTypeBuilder<WechatMoment> builder)
        {
            builder.ToTable("WechatMoment");

            builder.HasKey(ci => ci.Id);

            builder.Property(ci => ci.Id)
               .UseHiLo("wechatmoment_hilo")
               .IsRequired();
            builder.Property(cb => cb.OverheadOrder)
                .IsRequired(false);
            builder.Property(cb => cb.UserId)
               .IsRequired(true);
            builder.Property(cb => cb.Message)
                .IsRequired(false)
                .HasMaxLength(500); ;
            builder.Property(cb => cb.ImageNames)
               .IsRequired(false)
               .HasMaxLength(500);
            builder.Property(cb => cb.CreateTime)
               .IsRequired(true);
            builder.Property(cb => cb.IsRemove)
               .IsRequired(true);
            builder.Property(cb => cb.RemoveTime)
                .IsRequired(false);
        }
    }
}
